function S = AIA_step2_S(Phi)
    [I_row, I_col] = size(Phi);
    N = I_row*I_col;
    S11 = N;
    S12 = cos(Phi);S12 = sum(S12(:));
    S13 = sin(Phi);S13 = sum(S13(:));
    S22 = cos(Phi).*cos(Phi);S22 = sum(S22(:));
    S23 = cos(Phi).*sin(Phi);S23 = sum(S23(:));
    S33 = sin(Phi).*sin(Phi);S33 = sum(S33(:));
    S = [S11, S12, S13;
         S12, S22, S23;
         S13, S23, S33];
end